<?php
include "tools/tools.php";

#题库计数

$db = local_db();
$class_label = array(
    'Kanon','Air','Clannad_TA','planetarian','LittleBusters_KW','AngelBeats',
    'Rewrite','Charlotte','Harmonia','SummerPockets','Kami_Hi','Loopers',
    'PrimaDoll','Kaginado','LUNARiA','HBR','Stella','pre_Key','Staff','Music','other'
);
$class_num = count($class_label);

echo '总题库：<br>';
for ($i = 0; $i < $class_num; $i++){
    $label = $class_label[$i];
    $sql = "SELECT * FROM `questions_con` WHERE `label` LIKE '%$label%'";
    $result = $db->query($sql);
    $num = $result->num_rows;
    echo $label.':'.$num.'<br>';
}
echo '<br>入站题库：<br>';
$sheet = 'questions';
for ($i = 0; $i < $class_num; $i++){
    $label = $class_label[$i];
    $sql = "SELECT * FROM `$sheet` INNER JOIN `questions_con` ON `$sheet`.`contribute_No`=`questions_con`.`No` WHERE `questions_con`.`label` LIKE '%$label%'";
    $result = $db->query($sql);
    $num = $result->num_rows;
    echo $label.':'.$num.'<br>';
}
echo '<br>高难题库：<br>';
$sheet = 'questions_hard';
for ($i = 0; $i < $class_num; $i++){
    $label = $class_label[$i];
    $sql = "SELECT * FROM `$sheet` INNER JOIN `questions_con` ON `$sheet`.`contribute_No`=`questions_con`.`No` WHERE `questions_con`.`label` LIKE '%$label%'";
    $result = $db->query($sql);
    $num = $result->num_rows;
    echo $label.':'.$num.'<br>';
}

?>